﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dycox.Collections;

namespace Dycox.Reporting
{
    public class DataSheetCell
    {
        internal DataSheetCell(DataSheetColumn column)
        {
            if (column == null)
                throw new ArgumentNullException("column");

            _column = column;
        }

        private DataSheetColumn _column;

        public DataSheetColumn Column
        {
            get { return _column; }
        }

        private DataSheetRow _row;

        public DataSheetRow Row
        {
            get { return _row; }
            internal set { _row = value; }
        }

        private object _value;

        public object Value
        {
            get { return _value; }
            set { _value = value; }
        }

    }

    public class DataSheetCellCollection : OwnedCollection<DataSheetCell, DataSheetRow>
    {
        public DataSheetCellCollection(DataSheetRow row)
            : base(row)
        {

        }

        protected override void SetItemOwner(DataSheetCell item, DataSheetRow owner)
        {
            item.Row = owner;
        }

        protected override DataSheetRow GetItemOwner(DataSheetCell item)
        {
            return item.Row;
        }
    }

}
